package com.homework;

import java.util.Objects;

/**
 * 描述: 披萨类
 *
 * @author CodeYang
 * @version 2020/12/17 9:09
 */
public class Pizza {
    /**
     * 名字
     */
    private String name;
    /**
     * 价格
     */
    private double price;
    /**
     * 大小
     */
    private double size;

    public Pizza() {
    }

    /**
     * 展示信息:
     */
    public void show(){
        System.out.println("名称:"+name);
        System.out.println("价格:"+price);
        System.out.println("大小:"+size);
    }

    public Pizza(String name, double price, double size) {
        this.name = name;
        this.price = price;
        this.size = size;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getSize() {
        return size;
    }

    public void setSize(double size) {
        this.size = size;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pizza pizza = (Pizza) o;
        return Double.compare(pizza.price, price) == 0 &&
                Double.compare(pizza.size, size) == 0 &&
                name.equals(pizza.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, price, size);
    }
}
